﻿using System;
using System.Collections.Generic;
using UnityEngine;

// Token: 0x0200024F RID: 591
public class H_VoiceLog
{
	// Token: 0x06000FC3 RID: 4035 RVA: 0x00065BEC File Offset: 0x00063DEC
	public void Clear()
	{
		this.priorityLogs.Clear();
		this.priorityLogsDic.Clear();
		for (int i = 0; i < this.pantLogs.Length; i++)
		{
			this.pantLogs[i] = string.Empty;
		}
	}

	// Token: 0x06000FC4 RID: 4036 RVA: 0x00065C38 File Offset: 0x00063E38
	public void AddPriorityTalk(string file)
	{
		if (this.priorityLogsDic.ContainsKey(file))
		{
			return;
		}
		H_VoiceLog.LogData logData = new H_VoiceLog.LogData(file, 300f);
		this.priorityLogs.Add(logData);
		this.priorityLogsDic.Add(file, logData);
	}

	// Token: 0x06000FC5 RID: 4037 RVA: 0x00065C7C File Offset: 0x00063E7C
	public void AddPant(string file)
	{
		for (int i = this.pantLogs.Length - 1; i > 0; i--)
		{
			this.pantLogs[i] = this.pantLogs[i - 1];
		}
		this.pantLogs[0] = file;
	}

	// Token: 0x06000FC6 RID: 4038 RVA: 0x00065CC0 File Offset: 0x00063EC0
	public void Update()
	{
		for (int i = 0; i < this.priorityLogs.Count; i++)
		{
			if (!this.priorityLogs[i].Update(Time.deltaTime))
			{
				this.priorityLogs.RemoveAt(i);
				i--;
			}
		}
	}

	// Token: 0x06000FC7 RID: 4039 RVA: 0x00065D14 File Offset: 0x00063F14
	public void Check(List<H_Voice.Data> hitDatas)
	{
		int num = 0;
		while (num < hitDatas.Count && hitDatas.Count > 1)
		{
			if (this.priorityLogsDic.ContainsKey(hitDatas[num].File))
			{
				hitDatas.RemoveAt(num);
				num--;
			}
			num++;
		}
		for (int i = 0; i < this.pantLogs.Length; i++)
		{
			int num2 = 0;
			while (num2 < hitDatas.Count && hitDatas.Count > 1)
			{
				if (hitDatas[num2].File == this.pantLogs[i])
				{
					hitDatas.RemoveAt(num2);
					num2--;
				}
				num2++;
			}
		}
	}

	// Token: 0x06000FC8 RID: 4040 RVA: 0x00065DD0 File Offset: 0x00063FD0
	public void Check(List<H_VisitorVoice.Data> hitDatas)
	{
		int num = 0;
		while (num < hitDatas.Count && hitDatas.Count > 1)
		{
			if (this.priorityLogsDic.ContainsKey(hitDatas[num].file))
			{
				hitDatas.RemoveAt(num);
				num--;
			}
			num++;
		}
		for (int i = 0; i < this.pantLogs.Length; i++)
		{
			int num2 = 0;
			while (num2 < hitDatas.Count && hitDatas.Count > 1)
			{
				if (hitDatas[num2].file == this.pantLogs[i])
				{
					hitDatas.RemoveAt(num2);
					num2--;
				}
				num2++;
			}
		}
	}

	// Token: 0x0400112E RID: 4398
	private const float talkForgetTime = 300f;

	// Token: 0x0400112F RID: 4399
	private const int pantLogNum = 5;

	// Token: 0x04001130 RID: 4400
	private List<H_VoiceLog.LogData> priorityLogs = new List<H_VoiceLog.LogData>();

	// Token: 0x04001131 RID: 4401
	private Dictionary<string, H_VoiceLog.LogData> priorityLogsDic = new Dictionary<string, H_VoiceLog.LogData>();

	// Token: 0x04001132 RID: 4402
	private string[] pantLogs = new string[5];

	// Token: 0x02000250 RID: 592
	private class LogData
	{
		// Token: 0x06000FC9 RID: 4041 RVA: 0x00065E8C File Offset: 0x0006408C
		public LogData(string file, float timer)
		{
			this.file = file;
			this.timer = timer;
		}

		// Token: 0x06000FCA RID: 4042 RVA: 0x00065EA4 File Offset: 0x000640A4
		public bool Update(float time)
		{
			this.timer -= time;
			return this.timer > 0f;
		}

		// Token: 0x04001133 RID: 4403
		public float timer;

		// Token: 0x04001134 RID: 4404
		public string file;
	}
}
